﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using JChatCore.City;
using JChatData.Helper;
using System.IO;
using JChatSerVices.GetConnect;
using JChatSerVices.UserService;
using JChatAdmin.Models;
using JChatCore.CounTry;
namespace JChatAdmin.Controllers
{
    public class AdminController : Controller
    {
        //
        // GET: /Admin/ể
        GetFileConnect _get;
        DBConectString _db;
        JChatSerVices.CityService.CityService _city;
        UserService _user ;
        JChatSerVices.CountryService.CountryService _country;
        /// <summary>
        /// Ctor start
        /// </summary>
        public AdminController()
        {
            _city = new JChatSerVices.CityService.CityService();
            _user = new UserService();
            _country = new JChatSerVices.CountryService.CountryService();
            _get = new GetFileConnect();
            string file = _get.GetFile("conn");
            _db = new DBConectString(file);
        }

        //show index
        public ActionResult Index()
        {
            return View();
        }

        //show login
        public ActionResult Login()
        {
            
            return View();
        }
       
        [HttpGet]
        public ActionResult List()//for test
        {
            var a = this._city.GetAllCity();
           if(a.Count>0)
                ViewBag.data = a;
           return View("List");
        }

        [HttpGet]
        public ActionResult List2()//for test
        {
            var a = this._user.GetAllUser();
            ViewBag.data = a;
            return View("List2");
        }

    }
}
